<script setup>
import Login from './component/login.vue'
import Register from './component/register.vue';
import forgetPassword from './component/forgetPassword.vue';
const isLogingFlag = ref(true)

const changeFlag = () => {
  isLogingFlag.value = !isLogingFlag.value
}
const forgetFlag = ref(false)
const changeForgetFlag = () => {
  forgetFlag.value = !forgetFlag.value
}
</script>

<template>
  <div class="login-container">
    <h1 data-text="通用流程审批系统" class="transparent-title">通用流程审批系统</h1>
    <el-card class="card" shadow="always">
      <div class="form">
        <Login v-if="isLogingFlag && !forgetFlag"></Login>
        <Register v-if="!isLogingFlag && !forgetFlag" @register='changeFlag'> </Register>
        <forgetPassword v-if="forgetFlag" @remember="changeForgetFlag"></forgetPassword>
      </div>
      <div class="changeForm">
        <p>
          <span class="text-link" v-if="isLogingFlag && !forgetFlag" @click="changeFlag">还没有账号,去注册</span>
          <span class="text-link" v-if="!isLogingFlag && !forgetFlag" @click="changeFlag">已有账号,去登录</span>
        </p>
        <p>
          <span class="text-link" v-if="isLogingFlag && !forgetFlag" @click="changeForgetFlag">哎呀~忘记密码了</span>
          <span class="text-link" v-if="isLogingFlag && forgetFlag" @click="changeForgetFlag">突然想起密码了！</span>
        </p>
      </div>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
.login-container {
  background: url('@/assets/image/login-bg.jpg') no-repeat center right;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;

  .transparent-title {
    position: relative;
    margin: 50px 0 0;
    font-size: 60px;
    letter-spacing: 10px;
    font-weight: 700;
    font-style: italic;
    -webkit-text-stroke: 1px #b5b5b5c9;
    color: transparent;

    &::after {
      content: attr(data-text);
      position: absolute;
      top: 0;
      left: 0;
      clip-path: circle(80px at 0% 50%);
      background-image: linear-gradient(to left, #9daffc, #d47777, #e5cd9a);
      background-clip: text;
      -webkit-background-clip: text;
      animation: move 10s infinite;
    }

    @keyframes move {

      0% {
        clip-path: circle(80px at 0% 50%);
      }

      50% {
        clip-path: circle(80px at 100% 50%);
      }

      100% {
        clip-path: circle(80px at 0% 50%);
      }

    }


  }


  .card {
    background-color: transparent;
    text-align: center;
    height: auto;
  }

  .changeForm {
    margin-top: 10px;
    transition: all 0.3s;

    .text-link {
      cursor: pointer;
      transition: all 0.3s;
      color: #707070;
      font-size: 14px;

      &:hover {
        transform: translateX(10px);
        color: #d47777;
        font-size: 18px;

      }
    }
  }

}

:deep(.el-card) {
  transform: all 0.3s;
  width: 25vw;
  height: 280px;

  &:has(h3) {
    width: 500px;
  }

  &:has(h4) {
    width: 400px;
  }
}
</style>
